﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace DICOMViewer.UC
{
    public partial class WaitForm : Form
    {
        public WaitForm(Form parent)
        {
            InitializeComponent();
            this.Owner = parent;
        }

        private Thread th;
        public string labelText = "正在数据通讯中，请等待... ";
        private int symbolIndex = 0;
        string[] symbolAry=  new string[] {"——","\\","|","/"};
        private void WaitForm_Load(object sender, EventArgs e)
        {
            this.labelWaiter.Text = labelText;
//            th = new Thread(
//                () =>
//                {
//                    while (true)
//                    {
//                        if (symbolIndex>=3)
//                        {
//                            symbolIndex = symbolIndex%3;
//                        }
//                        this.labelWaiter.Invoke(new EventHandler(delegate
//                        {
//                            this.labelWaiter.Text = labelText + symbolAry[symbolIndex];
//                            this.Refresh();
//                        }));
//                        Thread.Sleep(500);
//                    }
//                });
//            th.Start();
        }

        private void WaitForm_FormClosed(object sender, FormClosedEventArgs e)
        {
            if (th!=null && th.IsAlive)
            {
//                th.Abort();
            }
        }
    }
}
